/**
 * 
 */
package com.woniuxy.service.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import com.woniuxy.mapper.CheckinMapper;
import com.woniuxy.pojo.OGRoom;
import com.woniuxy.pojo.Order_yyh;
import com.woniuxy.service.CheckinService;

import lombok.Data;

/**
 * @author Fz
 * @date 2019年8月10日 下午3:58:46
 * @param 
 * @return
 */
@Transactional
@Data
@Service
public class CheckinServiceImpl implements CheckinService{
	@Resource
	private CheckinMapper checkinMapper;
	
	@Override
	public Order_yyh getOrder(String message) {
		Order_yyh orders = checkinMapper.getOrder(message);
		List<OGRoom> ogrooms = checkinMapper.getOGRoom(orders.getOid());
		for(OGRoom ogroom : ogrooms){
			if(ogroom.getRid()==0){
				ogroom.setRids(checkinMapper.getRid(ogroom.getRtname()));
			}
		}
		orders.setOgroom(ogrooms);
		return orders;
	}

	@Override
	public void update(Order_yyh order_yyh) {
		for(OGRoom ogroom : order_yyh.getOgroom()){
			checkinMapper.updateOd(ogroom);
			checkinMapper.updateRoom(ogroom);
		}
	}

}
